#include "precomp.h"
#include "jwaitcondition.h"
#include "jwaitcondition_p.h"
#include "jmutex_p.h"

// - class JWaitCondition -

/**
 * @brief JWaitCondition::JWaitCondition
 */
JWaitCondition::JWaitCondition()
{
    d = new JWaitConditionPrivate();
}

/**
 * @brief JWaitCondition::~JWaitCondition
 */
JWaitCondition::~JWaitCondition()
{
    delete d;
}

/**
 * @brief JWaitCondition::wait
 * @param mutex
 * @param time
 * @return
 */
bool JWaitCondition::wait(JMutex *mutex, unsigned long time)
{
    return d->waitCondition.wait(mutex->mutex(), time);
}

/**
 * @brief JWaitCondition::wait
 * @param readWriteLock
 * @param time
 * @return
 */
bool JWaitCondition::wait(JReadWriteLock *readWriteLock, unsigned long time)
{
    return d->waitCondition.wait(readWriteLock->base(), time);
}

/**
 * @brief JWaitCondition::wakeOne
 */
void JWaitCondition::wakeOne()
{
    d->waitCondition.wakeOne();
}

/**
 * @brief JWaitCondition::wakeAll
 */
void JWaitCondition::wakeAll()
{
    d->waitCondition.wakeAll();
}
